opd_data_raw %>%
mutate(response_time = `Arrival Time` - `Transmit Time`) -> opd_data_new
There is an issue here where this join is creating duplicates, I would love to figure this out in the merge but for now I’m just going to dedup separately
opd_data_new %>%
left_join(opd_grouped, "Description", na_matches = "never") %>%
select(Code:response_time, Grouping, 'Violent Crime' ) -> opd_data_new
distinct(opd_data_new) -> opd_data_new
opd_data_new %>%
mutate(dispatched = !is.na(`Dispatch Time`)) -> opd_data_new
opd_data_new %>%
group_by(Source) %>%
summarize(count = n()) %>%
mutate(perc = round(count/sum(count), digits = 4)) %>%
arrange(desc(count))
## `summarise()` ungrouping output (override with `.groups` argument)
## # A tibble: 5 x 3
## Source count perc
## <chr> <int> <dbl>
## 1 DEFAULT - PHONE INIT 181917 0.411
## 2 911 CALL 161411 0.364
## 3 FIELD INITIATED BY D 81160 0.183
## 4 MDT-INITIATED 18349 0.0414
## 5 ALARM 2 0
opd_data_new %>%
group_by(Grouping) %>%
summarize(count = n()) %>%
mutate(perc = round(count/sum(count), digits = 4)) %>%
arrange(desc(count))
## `summarise()` ungrouping output (override with `.groups` argument)
## # A tibble: 43 x 3
## Grouping count perc
## <chr> <int> <dbl>
## 1 Internal Police Call 65915 0.149
## 2 Disturbing the Peace 52984 0.120
## 3 Hang Up or Misdial 49475 0.112
## 4 Property Crime 40035 0.0904
## 5 Unknown 36753 0.083
## 6 Medical 33742 0.0762
## 7 Suspicious Person or Vehicle 24108 0.0544
## 8 Traffic/Vehicle 19699 0.0445
## 9 Alarm 19150 0.0432
## 10 Parking 18231 0.0412
## # … with 33 more rows
To work on later - there are some calls here that are missing Grouping that I excluded - I should go back and get them later. I also want to better investigate whether my assumptions about whether police (versus someone else) were dispatched are correct.
opd_data_new %>%
filter(!is.na(Grouping), dispatched = TRUE) %>%
group_by(`Violent Crime`) %>%
summarize(count = n()) %>%
mutate(perc = round(count/sum(count), digits = 4)) %>%
arrange(desc(count)) -> pie_chart_perc_violent_crime
## `summarise()` ungrouping output (override with `.groups` argument)
police_activity <- plot_ly(pie_chart_perc_violent_crime, labels = ~`Violent Crime`, values = ~perc, type = 'pie')
police_activity <- police_activity %>% layout(title = 'Police Activity Related to Violent or Serious Crime',
xaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE),
yaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE))
police_activity
## Warning: `arrange_()` is deprecated as of dplyr 0.7.0.
## Please use `arrange()` instead.
## See vignette('programming') for more help
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_warnings()` to see where this warning was generated.
opd_data_new %>%
filter(Source == '911 CALL') %>%
group_by(Grouping, `Violent Crime`) %>%
summarize(count = n()) %>%
ungroup() %>%
mutate(perc = round(count/sum(count), digits = 4)) %>%
arrange(desc(count))
## `summarise()` regrouping output by 'Grouping' (override with `.groups` argument)
## # A tibble: 42 x 4
## Grouping `Violent Crime` count perc
## <chr> <chr> <int> <dbl>
## 1 Hang Up or Misdial No 44635 0.276
## 2 Medical No 25253 0.156
## 3 Disturbing the Peace No 24258 0.150
## 4 Unknown No 14329 0.0888
## 5 Property Crime No 12787 0.0792
## 6 Mental Health No 6605 0.0409
## 7 Assault Yes 5929 0.0367
## 8 Suspicious Person or Vehicle No 4330 0.0268
## 9 Weapons Yes 3756 0.0233
## 10 Traffic/Vehicle No 2975 0.0184
## # … with 32 more rows
opd_data_new %>%
filter(Source == 'DEFAULT - PHONE INIT') %>%
group_by(Grouping, `Violent Crime`) %>%
summarize(count = n()) %>%
ungroup() %>%
mutate(perc = round(count/sum(count), digits = 4)) %>%
arrange(desc(count))
## `summarise()` regrouping output by 'Grouping' (override with `.groups` argument)
## # A tibble: 43 x 4
## Grouping `Violent Crime` count perc
## <chr> <chr> <int> <dbl>
## 1 Disturbing the Peace No 26920 0.148
## 2 Unknown No 20494 0.113
## 3 Property Crime No 19114 0.105
## 4 Alarm No 18724 0.103
## 5 Internal Police Call No 17577 0.0966
## 6 Parking No 9914 0.0545
## 7 Mental Health No 8522 0.0468
## 8 Medical No 7466 0.041
## 9 Suspicious Person or Vehicle No 6847 0.0376
## 10 Traffic/Vehicle No 5591 0.0307
## # … with 33 more rows
opd_data_new %>%
filter(Source %in% c('FIELD INITIATED BY D', 'MDT-INITIATED')) %>%
group_by(Grouping, `Violent Crime`) %>%
summarize(count = n()) %>%
ungroup() %>%
mutate(perc = round(count/sum(count), digits = 4)) %>%
arrange(desc(count))
## `summarise()` regrouping output by 'Grouping' (override with `.groups` argument)
## # A tibble: 41 x 4
## Grouping `Violent Crime` count perc
## <chr> <chr> <int> <dbl>
## 1 Internal Police Call No 47853 0.481
## 2 Suspicious Person or Vehicle No 12931 0.130
## 3 Traffic/Vehicle No 11133 0.112
## 4 Property Crime No 8134 0.0817
## 5 Parking No 7808 0.0785
## 6 <NA> <NA> 2981 0.03
## 7 Unknown No 1930 0.0194
## 8 Disturbing the Peace No 1806 0.0181
## 9 Medical No 1023 0.0103
## 10 Mental Health No 477 0.00480
## # … with 31 more rows
opd_data_new %>%
filter(Source == "911 CALL") %>%
filter(!is.na(Grouping), !is.na(`Violent Crime`)) %>%
group_by(Grouping, `Violent Crime`) %>%
summarize(count = n()) %>%
ungroup() %>%
mutate(percent = count/sum(count)*100) -> nine91_calls
## `summarise()` regrouping output by 'Grouping' (override with `.groups` argument)
nine91_calls %>%
filter(!is.na(Grouping), !is.na(`Violent Crime`), percent >= .2) %>%
ggplot(aes(x = percent, y = reorder(Grouping, percent), fill = `Violent Crime`)) +
geom_bar(stat = "identity") +
theme_ipsum()+
labs(title = "Oakland 2019 911 Calls by Type", caption = '2019 OPD Call Data, N = 442,839') +
theme(axis.title.y=element_blank()) +
scale_fill_brewer(palette="Dark2")
fig <- plot_ly(nine91_calls, labels = ~`Violent Crime`, values = ~percent, type = 'pie')
fig <- fig %>% layout(title = '911 Calls Related to Violent or Serious Crime',
xaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE),
yaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE))
fig
opd_data_new %>%
group_by(Grouping, `Violent Crime`) %>%
summarize(count = n()) %>%
filter(count >= 200, !is.na(Grouping)) %>%
ggplot(aes(x = count, y = reorder(Grouping, count), fill = `Violent Crime`)) +
geom_bar(stat = "identity") +
theme_ipsum()
## `summarise()` regrouping output by 'Grouping' (override with `.groups` argument)
’
opd_data_new %>%
mutate(response_time_hms = hms::as_hms(response_time)) -> opd_data_new
opd_data_new %>%
mutate(response_time_minutes = hour(response_time_hms)*60 + minute(response_time_hms) + 1) -> opd_data_new
opd_data_new %>%
filter(Source == "911 CALL", !is.na(response_time_minutes), !is.na(Grouping)) %>%
group_by(Grouping) %>%
summarize(mean_response = mean(response_time_minutes),
count = n()) %>%
arrange(mean_response) -> response_time_table
## `summarise()` ungrouping output (override with `.groups` argument)
write.csv(response_time_table,"response_time_table.csv", row.names = FALSE)
response_time_table %>%
ggplot(aes(x = mean_response, y = reorder(Grouping, -mean_response), fill = desc(`mean_response`))) +
geom_bar(stat = "identity") +
scale_colour_gradient(low = "tomato1", high = "red4") +
theme_ipsum()+
labs(title = "Response Time by Call Type", caption = '2019 OPD Call Data, N = 442,839') +
theme(axis.title.y=element_blank()) +
theme(axis.title.x=element_blank()) +
theme(legend.position = "none")
library(RColorBrewer)
opd_data_new %>%
filter(Source == "911 CALL", !is.na(response_time_minutes)) %>%
group_by(Beat) %>%
summarize(mean_response = mean(response_time_minutes),
count = n()) %>%
arrange(mean_response) -> mean_response_beat
## `summarise()` ungrouping output (override with `.groups` argument)
opd_data_new %>%
filter(Source == "911 CALL", !is.na(response_time_minutes)) %>%
group_by(Beat) %>%
summarize(mean_response = mean(response_time_minutes),
count = n()) -> scatter_plot
## `summarise()` ungrouping output (override with `.groups` argument)
opd_data_new %>%
filter(Source == "911 CALL", !is.na(response_time_minutes)) %>%
group_by(Beat) %>%
summarize(mean_response = mean(response_time_minutes),
count = n()) %>%
ggplot(aes(x = Beat, y = mean_response, size = count, color = mean_response)) +
geom_point() +
scale_colour_gradient(low = "turquoise1", high = "blue4") +
theme_ipsum() +
labs(color = "Time in Minutes", size = 'Number of Calls', y = 'Time in Minutes') +
theme(axis.text.x = element_text(angle = 90))+
labs(title = "Response Time by Beat", caption = '2019 OPD Call Data')
## `summarise()` ungrouping output (override with `.groups` argument)
theme(plot.caption=element_text(face="italic"))
## List of 1
## $ plot.caption:List of 11
## ..$ family : NULL
## ..$ face : chr "italic"
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : NULL
## ..$ debug : NULL
## ..$ inherit.blank: logi FALSE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## - attr(*, "class")= chr [1:2] "theme" "gg"
## - attr(*, "complete")= logi FALSE
## - attr(*, "validate")= logi TRUE
fig <- plot_ly(data = scatter_plot, type = "scatter", x = ~Beat, y = ~mean_response, size = ~count, color = ~mean_response)
fig
## No scatter mode specifed:
## Setting the mode to markers
## Read more about this attribute -> https://plot.ly/r/reference/#scatter-mode
## Warning: Ignoring 1 observations
## Warning: `line.width` does not currently support multiple values.
opd_data_new %>%
filter(Source == "911 CALL", !is.na(response_time_minutes), `Violent Crime` = TRUE) %>%
group_by(Beat) %>%
summarize(mean_response = mean(response_time_minutes),
count = n()) %>%
arrange(mean_response)
## `summarise()` ungrouping output (override with `.groups` argument)
## # A tibble: 59 x 3
## Beat mean_response count
## <chr> <dbl> <int>
## 1 PDT2 16 1
## 2 01X 70.2 874
## 3 03X 76.7 1588
## 4 02X 78.8 1166
## 5 03Y 80.4 775
## 6 13X 84.1 189
## 7 11X 84.8 622
## 8 09X 86.9 1021
## 9 16X 87.3 224
## 10 12X 88.1 750
## # … with 49 more rows
opd_data_new %>%
filter(Source == "911 CALL", !is.na(response_time_minutes), `Violent Crime` = TRUE) %>%
group_by(Beat) %>%
summarize(mean_response = mean(response_time_minutes),
count = n()) %>%
ggplot(aes(x = Beat, y = mean_response, size = count, color = desc(mean_response))) +
geom_point() +
theme(axis.text.x = element_text(angle = 90)) +
theme_ipsum()
## `summarise()` ungrouping output (override with `.groups` argument)
shape1.sf %>%
left_join(mean_response_beat, c("name" = "Beat"), na_matches = "never") %>%
select_all() -> shape_response.sf
theme_map <- function(base_size=9, base_family="") {
require(grid)
theme_bw(base_size=base_size, base_family=base_family) %+replace%
theme(axis.line=element_blank(),
axis.text=element_blank(),
axis.ticks=element_blank(),
axis.title=element_blank(),
panel.background=element_blank(),
panel.border=element_blank(),
panel.grid=element_blank(),
panel.spacing=unit(0, "lines"),
plot.background=element_blank(),
legend.justification = c(0,0),
legend.position = c(0,0)
)
}
shape_response.sf %>%
ggplot(aes(fill = mean_response)) +
geom_sf() +
coord_sf() +
theme_map() +
labs(title = "Average 911 Response Time by Beat", caption = '2019 OPD Call Data') +
theme(plot.caption=element_text(face="italic")) +
labs(fill = "Time in Mins")+
scale_fill_gradient(low = "turquoise1", high = "blue4")
## Loading required package: grid
lmout <- lm_robust(response_time ~ Beat + factor(Priority), data = opd_data_new)
summary(lmout)
##
## Call:
## lm_robust(formula = response_time ~ Beat + factor(Priority),
## data = opd_data_new)
##
## Standard error type: HC2
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|) CI Lower CI Upper
## (Intercept) -2807.2 1868.2 -1.5027 1.329e-01 -6468.83 854.3
## Beat02X 1212.7 734.8 1.6503 9.888e-02 -227.54 2652.9
## Beat02Y 1622.6 697.0 2.3278 1.992e-02 256.39 2988.8
## Beat03X 401.3 718.6 0.5584 5.766e-01 -1007.23 1809.8
## Beat03Y -4217.3 660.4 -6.3858 1.709e-10 -5511.78 -2922.9
## Beat04X 1887.8 928.5 2.0332 4.203e-02 68.00 3707.6
## Beat05X 3138.7 975.5 3.2176 1.293e-03 1226.80 5050.6
## Beat05Y 1905.7 891.1 2.1386 3.247e-02 159.19 3652.3
## Beat06X 2558.1 753.2 3.3961 6.836e-04 1081.76 4034.4
## Beat07X 3654.0 931.2 3.9240 8.713e-05 1828.88 5479.2
## Beat08X 3286.8 810.4 4.0557 4.999e-05 1698.40 4875.1
## Beat09X 1812.9 882.7 2.0539 3.999e-02 82.88 3542.9
## Beat10X 5047.2 1560.1 3.2351 1.216e-03 1989.38 8105.0
## Beat10Y 3001.0 1597.7 1.8783 6.033e-02 -130.41 6132.4
## Beat11X 1381.9 1025.6 1.3474 1.778e-01 -628.20 3392.0
## Beat12X 3412.5 1172.8 2.9096 3.619e-03 1113.80 5711.3
## Beat12Y 1732.4 842.7 2.0557 3.981e-02 80.67 3384.1
## Beat13X 2080.1 743.8 2.7966 5.165e-03 622.27 3537.8
## Beat13Y 3673.7 754.2 4.8707 1.113e-06 2195.43 5152.0
## Beat13Z 2512.1 845.8 2.9702 2.976e-03 854.43 4169.8
## Beat14X 3413.3 1026.1 3.3264 8.798e-04 1402.14 5424.5
## Beat14Y 3445.4 854.2 4.0336 5.496e-05 1771.21 5119.5
## Beat15X 2951.8 1110.2 2.6587 7.844e-03 775.78 5127.9
## Beat16X 1718.7 778.6 2.2075 2.728e-02 192.70 3244.8
## Beat16Y 1988.3 739.0 2.6907 7.131e-03 539.97 3436.7
## Beat17X 5056.1 1004.2 5.0350 4.782e-07 3087.91 7024.3
## Beat17Y 4373.4 763.5 5.7279 1.018e-08 2876.92 5869.9
## Beat18X 1491.8 768.2 1.9420 5.213e-02 -13.78 2997.5
## Beat18Y 4065.8 796.5 5.1043 3.323e-07 2504.57 5627.0
## Beat19X 1781.6 795.5 2.2395 2.512e-02 222.37 3340.8
## Beat20X 1638.8 683.2 2.3988 1.645e-02 299.81 2977.9
## Beat21X 5942.9 763.3 7.7857 6.961e-15 4446.84 7439.0
## Beat21Y 5522.4 727.0 7.5960 3.065e-14 4097.44 6947.3
## Beat22X 5115.1 937.5 5.4560 4.875e-08 3277.60 6952.7
## Beat22Y 5784.0 832.8 6.9456 3.779e-12 4151.83 7416.2
## Beat23X 4709.4 712.5 6.6093 3.870e-11 3312.82 6105.9
## Beat24X 8099.7 841.8 9.6221 6.507e-22 6449.80 9749.5
## Beat24Y 11274.4 956.2 11.7910 4.434e-32 9400.32 13148.5
## Beat25X 9093.2 977.1 9.3062 1.335e-20 7178.10 11008.3
## Beat25Y 12245.1 1364.8 8.9721 2.929e-19 9570.16 14920.1
## Beat26X 11157.2 1021.1 10.9263 8.755e-28 9155.81 13158.6
## Beat26Y 10266.3 802.4 12.7942 1.817e-37 8693.59 11839.0
## Beat27X 8187.4 855.3 9.5729 1.048e-21 6511.11 9863.7
## Beat27Y 11440.4 868.4 13.1747 1.266e-39 9738.46 13142.4
## Beat28X 4970.3 843.7 5.8912 3.839e-09 3316.73 6623.9
## Beat29X 9986.6 915.7 10.9063 1.091e-27 8191.87 11781.2
## Beat30X 12000.2 870.1 13.7915 2.979e-43 10294.76 13705.6
## Beat30Y 2478.4 757.9 3.2700 1.076e-03 992.88 3963.9
## Beat31X 370.0 729.3 0.5074 6.119e-01 -1059.40 1799.4
## Beat31Y 14174.6 2034.4 6.9674 3.238e-12 10187.18 18162.0
## Beat31Z 15580.8 1270.4 12.2643 1.442e-34 13090.81 18070.8
## Beat32X 10938.7 873.1 12.5278 5.394e-36 9227.33 12650.0
## Beat32Y 10795.4 1121.6 9.6252 6.315e-22 8597.11 12993.6
## Beat33X 9828.9 836.5 11.7500 7.202e-32 8189.42 11468.5
## Beat34X 7888.3 840.4 9.3862 6.272e-21 6241.09 9535.5
## Beat35X 10046.6 851.1 11.8040 3.800e-32 8378.43 11714.8
## Beat35Y 11055.0 1057.8 10.4508 1.472e-25 8981.74 13128.3
## BeatPDT2 -5039.5 833.0 -6.0497 1.453e-09 -6672.18 -3406.8
## factor(Priority)1 -1378.8 1752.6 -0.7867 4.314e-01 -4813.87 2056.2
## factor(Priority)2 7827.2 1752.0 4.4675 7.918e-06 4393.28 11261.2
## factor(Priority)3 11192.7 1755.9 6.3743 1.841e-10 7751.18 14634.3
## factor(Priority)4 -448.1 1751.6 -0.2558 7.981e-01 -3881.26 2985.1
## factor(Priority)5 1415.5 1869.3 0.7572 4.489e-01 -2248.30 5079.3
## factor(Priority)6 -3752.4 1781.6 -2.1062 3.518e-02 -7244.24 -260.6
## factor(Priority)9 331.8 1792.0 0.1852 8.531e-01 -3180.48 3844.2
## DF
## (Intercept) 242145
## Beat02X 242145
## Beat02Y 242145
## Beat03X 242145
## Beat03Y 242145
## Beat04X 242145
## Beat05X 242145
## Beat05Y 242145
## Beat06X 242145
## Beat07X 242145
## Beat08X 242145
## Beat09X 242145
## Beat10X 242145
## Beat10Y 242145
## Beat11X 242145
## Beat12X 242145
## Beat12Y 242145
## Beat13X 242145
## Beat13Y 242145
## Beat13Z 242145
## Beat14X 242145
## Beat14Y 242145
## Beat15X 242145
## Beat16X 242145
## Beat16Y 242145
## Beat17X 242145
## Beat17Y 242145
## Beat18X 242145
## Beat18Y 242145
## Beat19X 242145
## Beat20X 242145
## Beat21X 242145
## Beat21Y 242145
## Beat22X 242145
## Beat22Y 242145
## Beat23X 242145
## Beat24X 242145
## Beat24Y 242145
## Beat25X 242145
## Beat25Y 242145
## Beat26X 242145
## Beat26Y 242145
## Beat27X 242145
## Beat27Y 242145
## Beat28X 242145
## Beat29X 242145
## Beat30X 242145
## Beat30Y 242145
## Beat31X 242145
## Beat31Y 242145
## Beat31Z 242145
## Beat32X 242145
## Beat32Y 242145
## Beat33X 242145
## Beat34X 242145
## Beat35X 242145
## Beat35Y 242145
## BeatPDT2 242145
## factor(Priority)1 242145
## factor(Priority)2 242145
## factor(Priority)3 242145
## factor(Priority)4 242145
## factor(Priority)5 242145
## factor(Priority)6 242145
## factor(Priority)9 242145
##
## Multiple R-squared: 0.02016 , Adjusted R-squared: 0.0199
## F-statistic: 290 on 64 and 242145 DF, p-value: < 2.2e-16
lmout2 <- lm_robust(response_time ~ Beat + Grouping + factor(Priority), data = opd_data_new)
summary(lmout2)
##
## Call:
## lm_robust(formula = response_time ~ Beat + Grouping + factor(Priority),
## data = opd_data_new)
##
## Standard error type: HC2
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -19042.58 1994.3 -9.548320 1.330e-21
## Beat02X 1324.35 751.5 1.762310 7.802e-02
## Beat02Y 2258.86 713.5 3.165896 1.546e-03
## Beat03X 1769.07 732.0 2.416687 1.566e-02
## Beat03Y 975.29 681.6 1.430913 1.525e-01
## Beat04X 2305.31 935.8 2.463563 1.376e-02
## Beat05X 2776.30 987.6 2.811218 4.936e-03
## Beat05Y 2060.94 884.5 2.330109 1.980e-02
## Beat06X 2096.00 768.4 2.727745 6.377e-03
## Beat07X 3518.39 940.4 3.741199 1.832e-04
## Beat08X 3468.96 827.7 4.191269 2.775e-05
## Beat09X 2450.48 901.2 2.719126 6.546e-03
## Beat10X 4401.99 1560.1 2.821515 4.780e-03
## Beat10Y 3968.01 1664.6 2.383764 1.714e-02
## Beat11X 1967.11 1034.7 1.901057 5.730e-02
## Beat12X 4029.78 1180.0 3.415106 6.377e-04
## Beat12Y 2675.98 849.5 3.150050 1.633e-03
## Beat13X 2795.30 754.5 3.704734 2.117e-04
## Beat13Y 3996.24 764.3 5.228301 1.712e-07
## Beat13Z 3906.93 847.4 4.610266 4.024e-06
## Beat14X 3703.85 1032.0 3.589042 3.320e-04
## Beat14Y 3665.53 855.1 4.286677 1.814e-05
## Beat15X 3994.08 1156.9 3.452365 5.558e-04
## Beat16X 2502.42 779.8 3.209250 1.331e-03
## Beat16Y 2702.97 742.8 3.638788 2.740e-04
## Beat17X 4875.20 1006.2 4.844927 1.267e-06
## Beat17Y 4953.56 791.0 6.262559 3.794e-10
## Beat18X 3026.16 771.8 3.921083 8.818e-05
## Beat18Y 3800.38 805.6 4.717308 2.391e-06
## Beat19X 4085.89 816.8 5.002081 5.676e-07
## Beat20X 3408.50 698.2 4.881927 1.051e-06
## Beat21X 5072.54 773.6 6.557047 5.500e-11
## Beat21Y 4713.63 741.4 6.358003 2.048e-10
## Beat22X 4956.01 948.0 5.227751 1.717e-07
## Beat22Y 5271.21 838.4 6.287517 3.231e-10
## Beat23X 6516.53 721.3 9.033956 1.668e-19
## Beat24X 8039.66 853.7 9.417292 4.668e-21
## Beat24Y 10905.93 955.7 11.411430 3.733e-30
## Beat25X 9418.60 988.7 9.526615 1.639e-21
## Beat25Y 11519.77 1348.8 8.540676 1.342e-17
## Beat26X 10951.85 1017.7 10.761605 5.301e-27
## Beat26Y 10187.80 809.8 12.580443 2.778e-36
## Beat27X 8739.17 872.8 10.012356 1.360e-23
## Beat27Y 11093.21 871.3 12.731978 4.039e-37
## Beat28X 5763.51 841.9 6.845897 7.618e-12
## Beat29X 9124.07 924.4 9.870035 5.672e-23
## Beat30X 12003.89 881.0 13.625051 2.948e-42
## Beat30Y 6600.10 794.6 8.306120 9.939e-17
## Beat31X 5133.69 752.0 6.826695 8.710e-12
## Beat31Y 13505.58 2034.2 6.639169 3.161e-11
## Beat31Z 15309.94 1259.6 12.154749 5.540e-34
## Beat32X 10337.24 873.2 11.838594 2.518e-32
## Beat32Y 11458.47 1117.4 10.254594 1.142e-24
## Beat33X 8965.75 841.6 10.652603 1.719e-26
## Beat34X 7740.44 846.1 9.147832 5.853e-20
## Beat35X 9206.59 859.6 10.710679 9.198e-27
## Beat35Y 11913.28 1096.3 10.866589 1.688e-27
## BeatPDT2 2223.24 937.5 2.371522 1.772e-02
## GroupingAnimal 8665.40 931.7 9.300877 1.404e-20
## GroupingAssault 4448.52 418.5 10.630516 2.179e-26
## GroupingContempt of Court -8457.86 696.2 -12.147951 6.020e-34
## GroupingCrimes Against Child 8828.71 1261.7 6.997674 2.609e-12
## GroupingDisturbing the Peace 1418.21 223.2 6.353761 2.105e-10
## GroupingDrug Dealing 1353.30 2026.7 0.667724 5.043e-01
## GroupingElderly -1650.01 501.9 -3.287840 1.010e-03
## GroupingElectronic Device 6006.85 1725.5 3.481124 4.994e-04
## GroupingEvent Related Calls -12385.03 1828.1 -6.774632 1.250e-11
## GroupingExplosion 2033.01 610.3 3.331193 8.649e-04
## GroupingFire 883.09 425.3 2.076571 3.784e-02
## GroupingForced Entry 601.49 508.2 1.183629 2.366e-01
## GroupingFound Juvenile 150.27 564.3 0.266272 7.900e-01
## GroupingGambling -5454.89 917.1 -5.947829 2.721e-09
## GroupingHang Up or Misdial -3066.78 182.0 -16.850163 1.139e-63
## GroupingHazardous Situation -1262.10 306.1 -4.122526 3.749e-05
## GroupingHomelessness 3171.25 647.1 4.900816 9.550e-07
## GroupingInternal Police Call -18373.10 375.6 -48.919384 0.000e+00
## GroupingIntimate Partner Violence -4733.79 945.8 -5.005173 5.585e-07
## GroupingKidnapping 313.79 673.3 0.466059 6.412e-01
## GroupingMedical -3355.29 291.4 -11.515633 1.121e-30
## GroupingMental Health 312.63 215.7 1.449153 1.473e-01
## GroupingMissing Person 12562.09 8173.6 1.536911 1.243e-01
## GroupingMurder -10.74 1991.1 -0.005394 9.957e-01
## GroupingParking -10240.50 421.6 -24.289934 3.613e-130
## GroupingProperty Crime 296.10 312.9 0.946333 3.440e-01
## GroupingProstitution -2902.48 446.9 -6.493999 8.375e-11
## GroupingProtestors -8297.86 854.5 -9.710774 2.739e-22
## GroupingRobbery 5469.11 601.4 9.093693 9.644e-20
## GroupingSexual Assault 4381.33 942.0 4.651329 3.300e-06
## GroupingSideshow -10973.97 575.9 -19.056896 6.620e-81
## GroupingStalking 26267.49 4542.3 5.782924 7.350e-09
## GroupingSuspicious Person or Vehicle -7359.19 159.8 -46.051441 0.000e+00
## GroupingTraffic/Vehicle -6178.23 267.3 -23.115257 4.393e-118
## GroupingTrespassing 2499.13 448.8 5.568226 2.576e-08
## GroupingUnknown 14947.27 1448.7 10.317436 5.949e-25
## GroupingUnsecured Premise -273.15 969.4 -0.281763 7.781e-01
## GroupingUse of Drugs or Alcohol -2371.41 498.3 -4.759078 1.946e-06
## GroupingUtilities 21762.52 1917.1 11.351558 7.416e-30
## GroupingVehicle Collision -2243.84 371.9 -6.034089 1.601e-09
## GroupingWeapons 1754.32 433.7 4.044676 5.241e-05
## factor(Priority)1 12825.83 1888.3 6.792121 1.108e-11
## factor(Priority)2 24408.74 1920.8 12.707849 5.499e-37
## factor(Priority)3 36396.29 1918.9 18.967029 3.662e-80
## factor(Priority)4 27734.01 1923.3 14.419669 4.075e-47
## factor(Priority)5 29137.88 3299.1 8.832025 1.035e-18
## factor(Priority)6 28513.19 1958.3 14.560509 5.253e-48
## factor(Priority)9 30818.57 1943.2 15.859506 1.292e-56
## CI Lower CI Upper DF
## (Intercept) -22951.43 -15133.7 237831
## Beat02X -148.54 2797.2 237831
## Beat02Y 860.42 3657.3 237831
## Beat03X 334.33 3203.8 237831
## Beat03Y -360.60 2311.2 237831
## Beat04X 471.24 4139.4 237831
## Beat05X 840.67 4711.9 237831
## Beat05Y 327.38 3794.5 237831
## Beat06X 589.95 3602.0 237831
## Beat07X 1675.15 5361.6 237831
## Beat08X 1846.76 5091.2 237831
## Beat09X 684.15 4216.8 237831
## Beat10X 1344.13 7459.8 237831
## Beat10Y 705.44 7230.6 237831
## Beat11X -60.96 3995.2 237831
## Beat12X 1717.04 6342.5 237831
## Beat12Y 1010.98 4341.0 237831
## Beat13X 1316.46 4274.1 237831
## Beat13Y 2498.14 5494.3 237831
## Beat13Z 2245.97 5567.9 237831
## Beat14X 1681.18 5726.5 237831
## Beat14Y 1989.56 5341.5 237831
## Beat15X 1726.56 6261.6 237831
## Beat16X 974.13 4030.7 237831
## Beat16Y 1247.06 4158.9 237831
## Beat17X 2902.98 6847.4 237831
## Beat17Y 3403.26 6503.9 237831
## Beat18X 1513.52 4538.8 237831
## Beat18Y 2221.38 5379.4 237831
## Beat19X 2484.91 5686.9 237831
## Beat20X 2040.07 4776.9 237831
## Beat21X 3556.30 6588.8 237831
## Beat21Y 3260.57 6166.7 237831
## Beat22X 3097.92 6814.1 237831
## Beat22Y 3628.04 6914.4 237831
## Beat23X 5102.73 7930.3 237831
## Beat24X 6366.41 9712.9 237831
## Beat24Y 9032.78 12779.1 237831
## Beat25X 7480.85 11356.4 237831
## Beat25Y 8876.13 14163.4 237831
## Beat26X 8957.23 12946.5 237831
## Beat26Y 8600.59 11775.0 237831
## Beat27X 7028.43 10449.9 237831
## Beat27Y 9385.51 12800.9 237831
## Beat28X 4113.42 7413.6 237831
## Beat29X 7312.23 10935.9 237831
## Beat30X 10277.12 13730.7 237831
## Beat30Y 5042.69 8157.5 237831
## Beat31X 3659.79 6607.6 237831
## Beat31Y 9518.55 17492.6 237831
## Beat31Z 12841.19 17778.7 237831
## Beat32X 8625.83 12048.7 237831
## Beat32Y 9268.40 13648.5 237831
## Beat33X 7316.14 10615.4 237831
## Beat34X 6082.01 9398.9 237831
## Beat35X 7521.85 10891.3 237831
## Beat35Y 9764.52 14062.0 237831
## BeatPDT2 385.81 4060.7 237831
## GroupingAnimal 6839.34 10491.5 237831
## GroupingAssault 3628.33 5268.7 237831
## GroupingContempt of Court -9822.46 -7093.2 237831
## GroupingCrimes Against Child 6355.88 11301.5 237831
## GroupingDisturbing the Peace 980.73 1855.7 237831
## GroupingDrug Dealing -2619.04 5325.6 237831
## GroupingElderly -2633.64 -666.4 237831
## GroupingElectronic Device 2624.82 9388.9 237831
## GroupingEvent Related Calls -15968.15 -8801.9 237831
## GroupingExplosion 836.85 3229.2 237831
## GroupingFire 49.58 1716.6 237831
## GroupingForced Entry -394.52 1597.5 237831
## GroupingFound Juvenile -955.82 1256.4 237831
## GroupingGambling -7252.43 -3657.4 237831
## GroupingHang Up or Misdial -3423.50 -2710.1 237831
## GroupingHazardous Situation -1862.14 -662.1 237831
## GroupingHomelessness 1902.98 4439.5 237831
## GroupingInternal Police Call -19109.22 -17637.0 237831
## GroupingIntimate Partner Violence -6587.50 -2880.1 237831
## GroupingKidnapping -1005.82 1633.4 237831
## GroupingMedical -3926.36 -2784.2 237831
## GroupingMental Health -110.20 735.5 237831
## GroupingMissing Person -3457.95 28582.1 237831
## GroupingMurder -3913.33 3891.9 237831
## GroupingParking -11066.82 -9414.2 237831
## GroupingProperty Crime -317.16 909.4 237831
## GroupingProstitution -3778.48 -2026.5 237831
## GroupingProtestors -9972.66 -6623.1 237831
## GroupingRobbery 4290.34 6647.9 237831
## GroupingSexual Assault 2535.13 6227.5 237831
## GroupingSideshow -12102.63 -9845.3 237831
## GroupingStalking 17364.80 35170.2 237831
## GroupingSuspicious Person or Vehicle -7672.40 -7046.0 237831
## GroupingTraffic/Vehicle -6702.09 -5654.4 237831
## GroupingTrespassing 1619.45 3378.8 237831
## GroupingUnknown 12107.78 17786.8 237831
## GroupingUnsecured Premise -2173.19 1626.9 237831
## GroupingUse of Drugs or Alcohol -3348.05 -1394.8 237831
## GroupingUtilities 18004.97 25520.1 237831
## GroupingVehicle Collision -2972.68 -1515.0 237831
## GroupingWeapons 904.21 2604.4 237831
## factor(Priority)1 9124.74 16526.9 237831
## factor(Priority)2 20644.10 28173.4 237831
## factor(Priority)3 32635.24 40157.3 237831
## factor(Priority)4 23964.30 31503.7 237831
## factor(Priority)5 22671.70 35604.1 237831
## factor(Priority)6 24675.06 32351.3 237831
## factor(Priority)9 27009.90 34627.2 237831
##
## Multiple R-squared: 0.0489 , Adjusted R-squared: 0.04848
## F-statistic: 376.7 on 105 and 237831 DF, p-value: < 2.2e-16
lmout3 <- lm_robust(response_time ~ Beat + Grouping, data = opd_data_new)
summary(lmout3)
##
## Call:
## lm_robust(formula = response_time ~ Beat + Grouping, data = opd_data_new)
##
## Standard error type: HC2
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4781.8 668.8 7.1497 8.719e-13
## Beat02X 819.0 744.5 1.1001 2.713e-01
## Beat02Y 1885.1 706.5 2.6684 7.621e-03
## Beat03X 1358.7 725.7 1.8722 6.118e-02
## Beat03Y 1556.1 672.5 2.3140 2.067e-02
## Beat04X 1972.3 932.7 2.1145 3.448e-02
## Beat05X 2339.2 984.4 2.3761 1.750e-02
## Beat05Y 2012.8 886.1 2.2715 2.312e-02
## Beat06X 1760.8 762.8 2.3083 2.098e-02
## Beat07X 2964.3 936.9 3.1640 1.556e-03
## Beat08X 3159.1 820.1 3.8520 1.172e-04
## Beat09X 2354.2 897.1 2.6244 8.681e-03
## Beat10X 4163.7 1559.2 2.6704 7.577e-03
## Beat10Y 3841.8 1664.5 2.3080 2.100e-02
## Beat11X 1845.0 1031.5 1.7886 7.368e-02
## Beat12X 3733.2 1177.1 3.1716 1.516e-03
## Beat12Y 2612.0 845.5 3.0892 2.007e-03
## Beat13X 2485.2 755.1 3.2913 9.973e-04
## Beat13Y 3623.8 761.7 4.7572 1.964e-06
## Beat13Z 3429.9 842.3 4.0721 4.661e-05
## Beat14X 3638.4 1029.7 3.5333 4.104e-04
## Beat14Y 3836.8 851.9 4.5035 6.687e-06
## Beat15X 3796.6 1155.0 3.2872 1.012e-03
## Beat16X 2248.1 779.8 2.8830 3.939e-03
## Beat16Y 2579.1 740.5 3.4828 4.962e-04
## Beat17X 4207.7 1010.1 4.1657 3.105e-05
## Beat17Y 4374.5 788.3 5.5491 2.875e-08
## Beat18X 2274.5 772.0 2.9462 3.217e-03
## Beat18Y 3197.4 808.3 3.9557 7.632e-05
## Beat19X 3162.4 812.3 3.8933 9.891e-05
## Beat20X 3220.6 693.6 4.6434 3.429e-06
## Beat21X 4477.5 776.4 5.7672 8.069e-09
## Beat21Y 4431.8 739.9 5.9895 2.108e-09
## Beat22X 4653.8 948.8 4.9049 9.353e-07
## Beat22Y 4697.5 839.5 5.5957 2.199e-08
## Beat23X 5199.8 715.4 7.2682 3.653e-13
## Beat24X 7171.2 858.8 8.3499 6.867e-17
## Beat24Y 10062.9 967.7 10.3993 2.529e-25
## Beat25X 9078.9 992.6 9.1466 5.919e-20
## Beat25Y 11341.7 1381.8 8.2080 2.261e-16
## Beat26X 10291.6 1021.6 10.0742 7.261e-24
## Beat26Y 9132.3 809.3 11.2847 1.590e-29
## Beat27X 8041.3 873.6 9.2044 3.463e-20
## Beat27Y 10115.7 875.0 11.5606 6.652e-31
## Beat28X 5157.4 845.4 6.1007 1.058e-09
## Beat29X 8350.9 926.6 9.0120 2.037e-19
## Beat30X 10901.8 881.0 12.3738 3.714e-35
## Beat30Y 6774.3 785.5 8.6236 6.525e-18
## Beat31X 4794.2 745.7 6.4290 1.287e-10
## Beat31Y 12839.7 2040.6 6.2921 3.137e-10
## Beat31Z 14487.0 1275.9 11.3541 7.204e-30
## Beat32X 9496.7 881.5 10.7733 4.668e-27
## Beat32Y 10237.9 1120.7 9.1350 6.587e-20
## Beat33X 7973.1 843.9 9.4475 3.501e-21
## Beat34X 6475.8 846.2 7.6531 1.969e-14
## Beat35X 8172.3 861.2 9.4890 2.353e-21
## Beat35Y 11191.0 1109.1 10.0905 6.153e-24
## BeatPDT2 1246.3 866.6 1.4381 1.504e-01
## GroupingAnimal 13461.7 913.6 14.7345 4.070e-49
## GroupingAssault -3082.7 335.4 -9.1911 3.917e-20
## GroupingContempt of Court -7833.8 668.3 -11.7217 1.007e-31
## GroupingCrimes Against Child 8295.6 1312.3 6.3212 2.600e-10
## GroupingDisturbing the Peace 1121.5 229.9 4.8784 1.070e-06
## GroupingDrug Dealing 3355.4 1961.8 1.7104 8.719e-02
## GroupingElderly -8158.9 315.0 -25.8985 1.112e-147
## GroupingElectronic Device 6869.5 1738.4 3.9515 7.769e-05
## GroupingEvent Related Calls -6339.7 1065.2 -5.9515 2.660e-09
## GroupingExplosion -8468.1 505.7 -16.7456 6.628e-63
## GroupingFire -9136.7 282.5 -32.3428 5.525e-229
## GroupingForced Entry -9390.8 491.2 -19.1195 2.002e-81
## GroupingFound Juvenile -9783.8 430.8 -22.7097 4.751e-114
## GroupingGambling -3992.8 910.6 -4.3847 1.162e-05
## GroupingHang Up or Misdial -1946.2 183.5 -10.6038 2.901e-26
## GroupingHazardous Situation -1640.1 309.9 -5.2917 1.213e-07
## GroupingHomelessness 4173.6 650.2 6.4189 1.375e-10
## GroupingInternal Police Call -8423.9 183.7 -45.8634 0.000e+00
## GroupingIntimate Partner Violence -5992.4 954.0 -6.2813 3.363e-10
## GroupingKidnapping -8661.4 693.9 -12.4826 9.530e-36
## GroupingMedical -6974.2 196.8 -35.4425 1.981e-274
## GroupingMental Health -2903.0 193.8 -14.9790 1.063e-50
## GroupingMissing Person 8259.9 8108.0 1.0187 3.083e-01
## GroupingMurder -8869.2 1310.5 -6.7677 1.312e-11
## GroupingParking -1623.1 247.8 -6.5511 5.724e-11
## GroupingProperty Crime 5925.8 294.1 20.1475 3.370e-90
## GroupingProstitution -2741.0 438.9 -6.2447 4.254e-10
## GroupingProtestors -7848.1 751.4 -10.4452 1.561e-25
## GroupingRobbery -1247.1 580.0 -2.1503 3.153e-02
## GroupingSexual Assault 2496.1 973.8 2.5632 1.037e-02
## GroupingSideshow -10046.2 364.1 -27.5893 2.754e-167
## GroupingStalking 36381.3 4602.1 7.9054 2.681e-15
## GroupingSuspicious Person or Vehicle -6664.3 162.2 -41.0759 0.000e+00
## GroupingTraffic/Vehicle -2593.0 286.8 -9.0422 1.547e-19
## GroupingTrespassing 3448.7 461.6 7.4705 8.017e-14
## GroupingUnknown 15112.9 1443.4 10.4703 1.198e-25
## GroupingUnsecured Premise 298.7 977.0 0.3057 7.598e-01
## GroupingUse of Drugs or Alcohol -3935.3 482.5 -8.1567 3.461e-16
## GroupingUtilities 32099.6 1938.7 16.5573 1.535e-61
## GroupingVehicle Collision -6259.4 366.2 -17.0923 1.854e-65
## GroupingWeapons -3407.1 411.9 -8.2721 1.323e-16
## CI Lower CI Upper DF
## (Intercept) 3470.95 6092.6 237838
## Beat02X -640.23 2278.3 237838
## Beat02Y 500.50 3269.8 237838
## Beat03X -63.73 2781.2 237838
## Beat03Y 238.07 2874.1 237838
## Beat04X 144.12 3800.4 237838
## Beat05X 409.70 4268.7 237838
## Beat05Y 276.05 3749.5 237838
## Beat06X 265.71 3255.8 237838
## Beat07X 1128.02 4800.6 237838
## Beat08X 1551.71 4766.5 237838
## Beat09X 596.01 4112.5 237838
## Beat10X 1107.69 7219.7 237838
## Beat10Y 579.38 7104.3 237838
## Beat11X -176.78 3866.8 237838
## Beat12X 1426.17 6040.2 237838
## Beat12Y 954.78 4269.2 237838
## Beat13X 1005.29 3965.2 237838
## Beat13Y 2130.82 5116.8 237838
## Beat13Z 1778.99 5080.7 237838
## Beat14X 1620.13 5656.6 237838
## Beat14Y 2166.97 5506.5 237838
## Beat15X 1532.87 6060.3 237838
## Beat16X 719.78 3776.5 237838
## Beat16Y 1127.72 4030.5 237838
## Beat17X 2227.95 6187.4 237838
## Beat17Y 2829.40 5919.6 237838
## Beat18X 761.39 3787.6 237838
## Beat18Y 1613.17 4781.6 237838
## Beat19X 1570.40 4754.5 237838
## Beat20X 1861.17 4580.0 237838
## Beat21X 2955.83 5999.2 237838
## Beat21Y 2981.55 5882.0 237838
## Beat22X 2794.16 6513.4 237838
## Beat22Y 3052.11 6342.8 237838
## Beat23X 3797.63 6602.0 237838
## Beat24X 5487.94 8854.6 237838
## Beat24Y 8166.35 11959.5 237838
## Beat25X 7133.42 11024.3 237838
## Beat25Y 8633.40 14049.9 237838
## Beat26X 8289.37 12293.9 237838
## Beat26Y 7546.12 10718.4 237838
## Beat27X 6328.96 9753.6 237838
## Beat27Y 8400.68 11830.7 237838
## Beat28X 3500.46 6814.3 237838
## Beat29X 6534.72 10167.1 237838
## Beat30X 9174.95 12628.6 237838
## Beat30Y 5234.61 8313.9 237838
## Beat31X 3332.64 6255.8 237838
## Beat31Y 8840.21 16839.3 237838
## Beat31Z 11986.23 16987.8 237838
## Beat32X 7769.01 11224.5 237838
## Beat32Y 8041.26 12434.4 237838
## Beat33X 6318.99 9627.2 237838
## Beat34X 4817.36 8134.3 237838
## Beat35X 6484.27 9860.3 237838
## Beat35Y 9017.26 13364.7 237838
## BeatPDT2 -452.28 2944.9 237838
## GroupingAnimal 11671.00 15252.3 237838
## GroupingAssault -3740.05 -2425.3 237838
## GroupingContempt of Court -9143.72 -6523.9 237838
## GroupingCrimes Against Child 5723.41 10867.7 237838
## GroupingDisturbing the Peace 670.92 1572.1 237838
## GroupingDrug Dealing -489.59 7200.4 237838
## GroupingElderly -8776.34 -7541.4 237838
## GroupingElectronic Device 3462.15 10276.8 237838
## GroupingEvent Related Calls -8427.54 -4251.9 237838
## GroupingExplosion -9459.26 -7477.0 237838
## GroupingFire -9690.37 -8583.0 237838
## GroupingForced Entry -10353.42 -8428.1 237838
## GroupingFound Juvenile -10628.24 -8939.4 237838
## GroupingGambling -5777.61 -2208.0 237838
## GroupingHang Up or Misdial -2305.88 -1586.4 237838
## GroupingHazardous Situation -2247.59 -1032.6 237838
## GroupingHomelessness 2899.21 5447.9 237838
## GroupingInternal Police Call -8783.86 -8063.9 237838
## GroupingIntimate Partner Violence -7862.25 -4122.6 237838
## GroupingKidnapping -10021.35 -7301.4 237838
## GroupingMedical -7359.90 -6588.5 237838
## GroupingMental Health -3282.87 -2523.2 237838
## GroupingMissing Person -7631.65 24151.5 237838
## GroupingMurder -11437.75 -6300.6 237838
## GroupingParking -2108.67 -1137.5 237838
## GroupingProperty Crime 5349.31 6502.3 237838
## GroupingProstitution -3601.30 -1880.7 237838
## GroupingProtestors -9320.73 -6375.4 237838
## GroupingRobbery -2383.76 -110.4 237838
## GroupingSexual Assault 587.39 4404.7 237838
## GroupingSideshow -10759.89 -9332.5 237838
## GroupingStalking 27361.42 45401.3 237838
## GroupingSuspicious Person or Vehicle -6982.31 -6346.3 237838
## GroupingTraffic/Vehicle -3155.01 -2030.9 237838
## GroupingTrespassing 2543.90 4353.5 237838
## GroupingUnknown 12283.90 17942.0 237838
## GroupingUnsecured Premise -1616.25 2213.6 237838
## GroupingUse of Drugs or Alcohol -4880.88 -2989.7 237838
## GroupingUtilities 28299.76 35899.3 237838
## GroupingVehicle Collision -6977.15 -5541.6 237838
## GroupingWeapons -4214.40 -2599.8 237838
##
## Multiple R-squared: 0.03207 , Adjusted R-squared: 0.03167
## F-statistic: 186.8 on 98 and 237838 DF, p-value: < 2.2e-16